package org.example.dao.ad;

import org.apache.ibatis.annotations.*;
import org.example.entity.Ad;

import java.util.List;

@Mapper
public interface AdMapper {

    List<Ad> listByReason(Integer advId, String goodsName, String title, String status);

   @Insert("insert into ad( goods_name, title, images, status, order_id) values (#{goodsName},#{title},#{images},#{status},#{orderId})")
    void insertAd(Ad ad);

    @Delete("delete from ad where adv_id = #{advId}")
    void DeleteAd(Integer advId);

    @Update("update ad set goods_name =#{goodsName},title = #{title},images = #{images} ,ad.status =#{status}," +
            "order_id = #{orderId} where adv_id = #{advId}")
    void updateAd(Ad ad);

    @Select("select * from ad where ad.status = '1'  ")
    List<Ad> list();
}
